export const state = () => ({
    searchHistory: []
})
export const mutations = {
    setHistory(state, data) {
        var flag = state.searchHistory.some(
            item =>
                item.departCity == data.departCity &&
                item.destCity == data.destCity &&
                item.departDate == data.departDate
        );

        if (!flag) {
            state.searchHistory.unshift(data)
        }
        if (state.searchHistory.length > 10) {
            state.searchHistory = state.searchHistory.slice(0, 10);
        }

    }
}